package com.season.seasonStudy.javase.j_020_typeconvert;

import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Test {

	public static void main(String[] args) {
		/*
		 * Phone p = new Phone(); p.show("sss", 123.0);
		 */
		// 1. 查找字符 indexOf()
		// 拼接字符 concat();
		// charAt 根据下标找字符
		// subSting 根据下表找多个字符
		// trim() 去空格
		// length() 返回长度
		// 字符串拆分
		/*
		 * Scanner in = new Scanner(System.in); while(true){
		 * System.out.println("请输入用户名"); String name= in.next();
		 * if(name.length()<3){ System.out.println("长度不够"); break;
		 * }System.out.println("请输入密码"); String passWord= in.next();
		 * System.out.println("请再次输入密码"); String passWord2= in.next(); if
		 * (!passWord.equals(passWord2)||passWord2.length()<6) {
		 * System.out.println("不对"); break;
		 * 
		 * } System.out.println("邮箱"); String email= in.next();
		 * if(email.indexOf('@') !=- 1 && email.indexOf('.') >
		 * email.indexOf('@')){ System.out.println("成功"); break; }
		 * System.out.println("继续"); }
		 */
		/*
		 * String str= new String(); str="0532-12345678";
		 * if(str.indexOf('-')==4&&str.length()==13){ System.out.println("正确");
		 * 
		 * } else{ System.out.println("错误"); }
		 */
		/*
		 * String words="长亭外 古道边 芳草碧连天 晚风扶 柳笛声残 夕阳山外山"; String[ ] printword=new
		 * String[100]; System.out.println("***原歌词格式***\n"+words);
		 * System.out.println("\n***拆分后歌词格式***"); printword=words.split(" ");
		 * for(int i=0;i<printword.length;i++){ System.out.println( printword[i]
		 * ); }
		 */
		/*
		 * StringBuffer sb = new StringBuffer("1234587879678"); for (int i =
		 * sb.length() - 3; i > 0; i = i - 3) {
		 * 
		 * sb.insert(i, ",");
		 * 
		 * } sb.insert(0, "$"); System.out.println(sb); // $1,234,587,879,678
		 */
		DecimalFormat df = new DecimalFormat("$0,000,000");
		String after = df.format(1234542313);
		System.out.println(after);
		try {
			Number n = df.parse(after);
			System.out.println(n);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		Date date = new Date();
		System.out.println(date);
		SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd");
		String d= sdf.format(date);
		System.out.println(d);
		try {
			sdf.parse(d);
			System.out.println(sdf.parse(d));
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		
	}

}
